﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mob___first_encounter
{
    class Vector2D
    {
        protected int x;
        protected int y;
        protected double normalizedX;
        protected double normalizedY;

        public Vector2D(int x, int y)
        {
            this.x = x;
            this.y = y;
            Normalize();
        }

        public Vector2D(int startX, int startY, int endX, int endY)
        {
            x = endX - startX;
            y = endY - startY;
        }

        public double CalculateLength()
        {
            return Math.Sqrt(x*x+y*y);
        }

        public void Normalize()
        {
            double vectorLength = CalculateLength();
            normalizedX = x / vectorLength;
            normalizedY = y / vectorLength;
        }

        public void addVector(Vector2D vector)
        {
            x += vector.GetX();
            y += vector.GetY();

            normalizedX += vector.GetNormalizedX();
            normalizedY += vector.GetNormalizedY();
        }

        public int GetX()
        {
            return x;
        }

        public int GetY()
        {
            return y;
        }

        public double GetNormalizedX()
        {
            return normalizedX;
        }

        public double GetNormalizedY()
        {
            return normalizedY;
        }
    }
}
